package org.smile.homework01.kevin.WithDrawMoney;

public class President extends Approver {
    public President(String name) {
        super(name + "银行行长");
    }
WithDrawMoney president = new PresidentWDM();
    //5000--10000由驻点经理审批
    @Override
    public void ProcessRequest(PurchaseRequest request) {
        if (request.getAmount() >= 10000) {
            System.out.println("取款单号" + request.getID() + "取款：" + request.getAmount() + "经过" + this.name + "审批");
            CBRC cbrc = new CBRC();
            if(request.getAmount() >= 10000 && request.getAmount() < 20000) {
                Observer commision1 = new Commission("阿龙");
//            Observer commision2 = new Commission("啊培");
                cbrc.registerObserver(commision1);
//            cbrc.registerObserver(commision2);
                cbrc.setInformation(request.getAmount());
            } else {
                Observer commision1 = new Commission("阿龙");
                Observer commision2 = new Commission("啊培");
                cbrc.registerObserver(commision1);
                cbrc.registerObserver(commision2);
                cbrc.setInformation(request.getAmount());
            }
            president.withDrawMoney();
        } else {
            successor.ProcessRequest(request);
        }
    }
}
